// 1. express 框架
const express = require("express");
// const fs = require("fs");
// const path = require("path");

// 2.创建一个后台路由
const router = express.Router();
// 导入goods数据模块
const goodsModel = require("../../model/goodsModel");

// 导入生成id的包
// const { v4: uuidv4 } = require("uuid");

router.get("/goodslist", async (req, res) => {
    // console.log(req.query);
    let { goods_type } = req.query;
    // console.log("1.0", goods_rq);
    await goodsModel
        .get_goods(goods_type)
        .then((content) => {
            // console.log(res);
            res.send(content);
        })
        .catch((err) => {
            // console.log(err);
            res.send(err);
        });
});

module.exports = router;
